<?php

/**
 *      [CodeJm!] Author CodeJm[codejm@163.com].
 *
 *
 *      $Id: Feelback.php 2016-03-31 15:42:44 codejm $
 */

class FeelbackModel extends \Core_CMode {

    public $_table = '`yaf_feelback`';

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
            'id' => 'id',
            'username' => '用户名称',
            'title' => '标题',
            'content' => '内容',
            'state' => '状态',
            'addtime' => '添加时间',
            'contact' => '联系人',
            'contact_phone' => '联系电话',
        );
    }

    /**
     * 楠岃瘉瑙勫垯
     *
     */
    public function rules() {
        return array(
            'default'=> array(
                array('title', 'required|maxlength[20]'),
                array('content', 'required|maxlength[150]'),
                array('addtime', 'maxlength[20]'),
                array('contact', 'required|maxlength[20]'),
                array('contact_phone', 'required'),
            ),
        );
    }

    /**
     * 鎵归噺鍒犻櫎
     *
     */
    public function delFeelbacks($ids) {
        $ids_str = implode(',', $ids);
        $where = 'id IN ('.$ids_str.')';
        return $this->delete($where);
    }
}

?>